package com.learn.spring.java_config;

import com.learn.spring.bean.Dog;
import com.learn.spring.bean.Person;
import com.learn.spring.conditional.TempConditional;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;

/**
 * @author wangxing
 * @version 2020/6/12 12:04 Administrator
 */
@Configuration
public class MainConditionalConfig {
    @Bean("dog")
    public Dog getDog() {
        return new Dog();
    }

    @Bean(name = "person")
    //监控的加载对象需要在被加载对象之后才行
    @Conditional(value = TempConditional.class)
    public Person getPerson() {
        return new Person();
    }

}
